import java.util.Random;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/**
 * @Author: fei.wu
 * @Email: fei.wu@rograndec.com
 * @CreateDate: 2018/11/8
 * @Version: 1.0
 */
public class SingleThreadExecutorTest {


    public void runThread (final int i){
        ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1);
        try{
            scheduledExecutorService.schedule(new Runnable() {
                @Override
                public void run() {
                    System.out.println("run : "+i);
                }
            }, 3, TimeUnit.SECONDS);
        }catch (Exception e){
            System.out.println("[InventoryLogModel][buildSolrIndex] buildSolrIndex 线程异常");
        }finally {
            System.out.println("shutdown : "+i);
            scheduledExecutorService.shutdown();
        }
    }

}

